/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author fzuir
* @date 2021-01-20
**/
@Entity
@Data
@Table(name="marked_json")
public class MarkedJson implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "marked_json_id")
    @ApiModelProperty(value = "ID")
    private Long markedJsonId;

    @Column(name = "file_path")
    @ApiModelProperty(value = "保存路径")
    private String filePath;

    @Column(name = "file_name")
    @ApiModelProperty(value = "文件名")
    private String fileName;

    @Column(name = "num_box")
    @ApiModelProperty(value = "有多少框")
    private Long numBox;

    @Column(name = "status")
    @ApiModelProperty(value = "0未识别/1已识别")
    private Long status;

    @Column(name = "result_path")
    @ApiModelProperty(value = "识别结果json路径")
    private String resultPath;

    @ManyToOne
    @JoinColumn(name = "mark_task_id")
    @ApiModelProperty(value = "标注任务的id")
    private TaskMark taskMark;

    @ManyToOne
    @JoinColumn(name = "user_id")
    @ApiModelProperty(value = "标注人员的id")
    private User user;

    @OneToOne
    @JoinColumn(name = "image_id")
    @ApiModelProperty(value = "图片id")
    private Image image;

    public void copy(MarkedJson source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}